home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-06-20 | 2.2 KB | 122 lines | [TEXT/MPS ] |
- include 'Traps.a'
- include 'SysEqu.a'
-
- ModalDialogTrapNum equ $191
-
- OkOkOkThreshold equ 120
-
-
- OkOkOk main
-
- move.l a0,-(sp) ; save a handle to ourselves
- _DetachResource ; use handle to us that we saved earlier
-
- move.w #ModalDialogTrapNum,d0
- _GetTrapAddress
- lea realAlertAddress,a1
- move.l a0,(a1) ; save a copy of the real _ModalDialog
-
- move.w #ModalDialogTrapNum,d0
- lea MyModalDialog,a0
- _SetTrapAddress
-
- lea oldJGNEFilter,a0
- move.l JGNEFilter,(a0)
- lea MyGNE,a0
- move.l a0,JGNEFilter
-
- rts
-
- MyModalDialog:
- jsr ResetClickTime
-
- move.l (sp)+,a0 ; get real return address so we can end around
-
- move.l (sp)+,d0 ; pull off params
- move.l (sp)+,d1
-
- move.l a0,-(sp) ; shove on real return address
-
- move.l d1,-(sp) ; re-stack parameters
- move.l d0,-(sp)
-
- lea MyGNEPatchEnable,a0 ; enable patch
- addq.l #1,(a0)
-
- move.l realAlertAddress,a0 ; invoke the previous jGNEFilter proc
- jsr (a0)
-
- lea MyGNEPatchEnable,a0 ; “disable” patch
- subq.l #1,(a0)
-
- rts ; bounce back to real caller
-
-
- ResetClickTime:
- clr.l -(sp) ; Save New Epoch
- _TickCount
- move.l (sp)+,d0
- lea alertCalledTicks,a0
- move.l d0,(a0)
- rts
-
-
- MyGNE:
- move.l d0,-(sp) ; save d0
-
- move.l MyGNEPatchEnable,d0 ; Are we enabled?
- cmp.l #0,d0
- beq.s justGNE ; no, skip our hack
-
- move evtNum(a1),d0
- cmp.l #mButDwnEvt,d0
- blt.s CheckForTimeout
- cmp.l #autoKeyEvt,d0
- bgt.s CheckForTimeOut
-
- jsr ResetClickTime ; The user did something so reset the timer
- bra.s justGNE ; then fall through and keep going
-
- CheckForTimeout:
- move.l evtTicks(a1),d0 ; compare time against start time
- sub.l alertCalledTicks,d0
- cmp.l #OkOkOkThreshold,d0
- blt.s justGNE
-
- move.w #keyDwnEvt,evtNum(a1) ; make the event a return!
- move.l #13,evtMessage(a1)
-
- move.l (sp)+,d0
-
- move.l #-1,d0
- move.w d0,4(sp)
-
- bra.s jumpBack
-
- justGNE:
- jsr UpdateProgress
- move.l (sp)+,d0 ; restore old d0
-
- jumpBack: ; Jump off to the “real” jGNEFilter Proc
- move.l oldJGNEFilter,a0
- jmp (a0)
-
-
- UpdateProgress:
-
- ; Do some useful HI interaction to let the user know how much time
- ; they have left…
- ;
- ; NOT!
- rts
-
- alertCalledTicks dc.l 0
- MyGNEPatchEnable dc.l 0
- oldJGNEFilter dc.l 0
- realReturnAddress dc.l 0
- realAlertAddress dc.l 0
-
- endmain
-
- end
-